<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>通用模块</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />

    <script type="text/javascript" src="../script/jquery.js"></script>

    <style>
        html,
        body {
            height: 100%;
            margin: 0px;
            padding: 0px;
        }

        body {
            display: flex;
            flex-flow: row wrap;
        }

        .lxb_div_context {
            flex-grow: 1;
            border: 1px #cbcaca solid;
            margin: 15px 15px 35px 15px;
            border-radius: 10px;
            box-shadow: 0 0 1px 1px rgba(190, 190, 195, 0.25);
            overflow:hidden;
        }

        .lxb_div_context_nickname {
            margin-left: 15px;
            margin-top: 15px;
            font-size: 15px;
            color: #101010;
            text-align: center;
        }

        .lxb_div_context_money {
            text-align: center;
            font-size: 25px;
            color: #101010;
            margin-top: 23px;
        }

        .lxb_div_context_currency_left {
            font-size: 14px;
            color: #919191;
            display: inline-block;
            width: 65px;
            height: 100%;
            padding-top: 13px;
            padding-bottom: 13px;
        }

        .lxb_div_context_currency_rigth {
            color: #101010;
            font-size: 15px;
            text-align: right;
            overflow: hidden;
            text-overflow: ellipsis;
            -webkit-box-flex:1.0;
            padding-top: 13px;
            padding-bottom: 13px;
            padding-left: 15px;
            letter-spacing: 2px;
        }

        .lxb_div_styleborder2{
          border-bottom: 1px #eaeaea solid;
          margin-left: 15px;
          margin-right: 15px;
          height: auto;
          display:-webkit-box;
        }
        .div_currency_ba{
          height: 20px;
          margin-left: 15px;
          margin-right: 15px;
          border-bottom: 1px #eaeaea solid;
        }

    </style>
</head>

<body>

    <div style="display:none"id="div_currency">
      <div class="lxb_div_styleborder2">
          <div class="lxb_div_context_currency_left">
          </div>
          <div class="lxb_div_context_currency_rigth">
          </div>
      </div>
    </div>

    <div class="lxb_div_context">
        <div class="lxb_div_context_nickname">
        </div>
        <div class="lxb_div_context_money">
        </div>
        <div class="div_currency_ba"></div>

    </div>

</body>

<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript">

// $(document).ready(function(){
//    //var obj = {"name1":"张三","name2":"李四"};
//    var obj = {"giveTime":"那里是可;fdkjgl;;lk虑","spendTime":"你好来的"};
//     setViewContext(obj);
//
// });
    apiready = function() {
        var data = api.pageParam;
        data = data.name;
        $('.lxb_div_context_money').text(backstageData(data.content.portTitle));
        var data1 = data.content.portContent;
        if(backstageData(JSON.stringify(data1)) === ''){
          api.toast({
              msg: '传入数据异常',
              duration: 2000,
              location: 'bottom'
          });
        }else {
           setViewContext(data1);
        }
    }

    /**设置view内容
     */
    function setViewContext(data) {
      var temp = document.getElementById('div_currency').innerHTML;
      for (var i in data) { //用javascript的for/in循环遍历对象的属性
            var div1 = document.createElement('div');
            div1.innerHTML = temp;
            var left = div1.getElementsByClassName('lxb_div_context_currency_left')[0];
            var rigth = div1.getElementsByClassName('lxb_div_context_currency_rigth')[0];
            left.innerText = i;
            rigth.innerText = data[i];
            console.log("key...."+i+'....vas...'+data[i]);
            $('.lxb_div_context').append(div1);
            //注册点击事件
      }
    }

    /**
    *判断后台的数据 进行判断处理
    */
    function backstageData(string){
           if(string !='' && string !=null && string !='undefined'){
              return string;
           }else {
             return '';
           }
    }
</script>

</html>
